/*
 ============================================================================
 Name        : TelCallTelephony_2nd.h
 Author      : Michael Liu
 Version     :
 Copyright   : 
 Description : CfCallEngine implementation
 ============================================================================
 */

#ifndef __TELCALLTELEPHONY_2ND_H__
#define __ANSPHONECALLWATCHER_H__
#ifndef __SERIES60_3X__

#include <etel.h>
#ifndef __SERIES60_2ND__
#include <etelagsm.h>
#include <etelbgsm.h>
#else
#include <etelmm.h>
#endif

class CMessagePopup;

/**
 *
 * @class MAnsPhoneCallWatcherObserver
 * @brief Mixin Class for Observers of the PhoneCall events
 * @version	1.0
 * @ingroup Engine
 * @{
 */
class TelCallTelephonyNotify
{
public:
    virtual void HandleCallInChangeL(const RCall::TStatus& aStatus) = 0;
};

class TelCallTelephony : public CActive
{
public:
    static TelCallTelephony* NewL(TelCallTelephonyNotify& aObserver, RLine& aLine);
    ~TelCallTelephony();

public: // CActive
    virtual void RunL();
    virtual void DoCancel();
    const TDesC& GetCuurentTelNumber();
private:
    //	the state of this object governs what happens when the
    //	StartL() / Stop() / RunL() / DoCancel() functions are called.
    enum TState
    {   EWaiting, EAnswering, EWatching};

private:
    TelCallTelephony(TelCallTelephonyNotify& aObserver, RLine& aLine);
    void ConstructL();

private:
    void StartL();
    void Stop();
    void SetCuurentTelNumber(TDesC16& aTelNumber );
private:
    TelCallTelephonyNotify& iObserver;
    RLine& iLine;
#ifndef __SERIES60_2ND__
    RAdvGsmCall iCall;
#else
    RMobileCall iCall;
#endif
    TName iCallName;
    RCall::TStatus iCallStatus;
    TState iState;
    HBufC16* iCurrentTelNumber;
    //      CMessagePopup*          iPopup;
};

#endif
#endif
///@}
